# setdefault方法传入两个参数, key 和 value
# setdefault(key[, value])
# 如果只传入key, 则value的值为none.

dict = {}

print(dict.setdefault('name'))
print(dict)
# None
# {'name': None}

print(dict.setdefault('age', 18))
print(dict)
# 18
# {'name': None, 'age': 18}